package com.jjw.springbootcvs.controller;

import com.jjw.springbootcvs.config.BootCvsProperties;
import jakarta.servlet.http.HttpSession;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author xiaojuan
 * @Date 2024/11/4
 * @Description
 */
@Controller
@RequiredArgsConstructor
public class LogOutController {

    private  final BootCvsProperties bootCvsProperties;

    @GetMapping("/logout")
    public String logout(HttpSession session){
        session.removeAttribute(bootCvsProperties.getSessionKey());
        return "/login";
    }
}
